//
// Created by lenovo on 24-12-28.
//
class Solution5
{
public:
    static int MoreThanHalfNum_Solution(vector<int>& numbers)
    {
        int count = 0;
        int can = 0;
        for(int number : numbers)
        {
            if(count == 0)
            {
                can = number;
                count = 1;
            }
            else if(number == can)
            {
                count++;
            }
            else
            {
                count--;
            }
        }
        return can;
    }
};